package com.wyj.user.api;

import com.wyj.response.ApiResult;
import com.wyj.user.entity.vo.SimpleUserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.InvocationTargetException;

/**
 * TODO: 用户认证相关API
 *
 * @author wuyijie
 * @date 2022/2/10 1:29 PM
 */
@Api(value = "IUser4AuthApi", tags = "用户认证相关API")
public interface IUser4AuthApi {
    /**
     * TODO: 注册
     *
     * @param email    email
     * @param password password
     * @param code     code
     * @return com.wyj.resoponse.ApiResult<SimpleUserVO>
     * @author wuyijie
     * @date 2022/2/11 1:56 PM
     */
    @ApiOperation(value = "register", notes = "注册")
    @RequestMapping(value = "/register/{email}/{password}/{code}", method = RequestMethod.GET)
    ApiResult<SimpleUserVO> register(@PathVariable(value = "email") String email,
                                     @PathVariable(value = "password") String password,
                                     @PathVariable(value = "code") String code);

    /**
     * TODO: 登录
     *
     * @author wuyijie
     * @date 2022/2/14 3:25 PM
     * @param email 邮箱
     * @param password 密码
     * @param request request
     * @param response response
     * @return com.wyj.response.ApiResult<com.wyj.user.entity.vo.SimpleUserVO>
     */
    @ApiOperation(value = "login", notes = "登录")
    @RequestMapping(value = "/login/{email}/{password}", method = RequestMethod.GET)
    ApiResult<SimpleUserVO> login(@PathVariable(value = "email") String email,
                 @PathVariable(value = "password") String password, HttpServletRequest request, HttpServletResponse response) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException;

    /**
     * TODO: 获取验证码
     *
     * @author wuyijie
     * @date 2022/2/13 12:51 AM
     * @param identification 唯一标识
     * @return com.wyj.response.ApiResult<Boolean>
     */
    @ApiOperation(value = "verificationCode", notes = "获取验证码")
    @RequestMapping(value = "/verificationCode/{identification}", method = RequestMethod.GET)
    ApiResult<Boolean> verificationCode(@PathVariable("identification") String identification);

}
